<template>
    <div>
        <div class="stuinfo_personal_title">学生个人信息查询</div>
        <el-row>
            <el-col :span="6" :offset="8">
                <el-input v-model="stu_id"></el-input>
            </el-col>

            <el-col :span="4" :offset="1">
                <el-button @click="getStuInfo">搜索</el-button>
            </el-col>
        </el-row>

        <div class="result_wrap" v-if="show">
            <img :src="result[0].stu_head_img" alt="" width="200px" height="200px">

            <div class="table_wrap">
                <el-table :data="result" style="width: 100%">

                    <el-table-column prop="stu_id" label="学号" width="130">
                    </el-table-column>

                    <el-table-column prop="stu_name" label="姓名" width="130">
                    </el-table-column>

                    <el-table-column prop="stu_jg" label="籍贯"> </el-table-column>

                    <el-table-column prop="stu_sex" label="性别"> </el-table-column>

                    <el-table-column prop="stu_date" label="出生日期"> </el-table-column>

                    <el-table-column prop="stu_hobby" label="爱好"> </el-table-column>

                    <el-table-column prop="stu_gbf" label="男或女朋友"> </el-table-column>

                </el-table>
            </div>
        </div>

    </div>
</template>

<script>
import { req_stu_info_personal } from "@/api/stuInfo.js"
export default {
    data() {
        return {
            stu_id: "",
            result:[],
            show:false,
        }
    },

    methods: {
    async getStuInfo() {
      console.log(this.stu_id);
      let result = await req_stu_info_personal(this.stu_id);
      console.log(result);
      this.result = result.data;
      this.show = true;
      console.log(this.result);
    },
  },
}
</script>

<style lang="scss" scoped>

div{
    .stuinfo_personal_title{
        height: 30px;
    text-align: center;
    font-size: 25px;
    font-weight: 700;
    margin-bottom: 20px;
    }
    .result_wrap {
    text-align: center;
    .table_wrap {
      height: 300px;
      .el-table__header-wrapper {
        height: 50px;
      }
    }
  }
}

</style>